import Sprite from './Sprite.js';
export default class AirPlane extends Sprite {
    constructor(x = 0, y = 0, width = 0, height = 0, imgPath = '') {
        super(x, y, width, height, imgPath);
        // 移动速度
        this.moveSpeed = 0;
        this.attackSpeed = 0;
        this.attack = 0;
        this.armor = 0;
        this.direction = 0;
        this.minX = 0;
        this.maxX = 0;
        this.minY = 0;
        this.maxY = 0;
    }
    setMoveArea(sx, sy) {
        this.minX = (this.width / 2) * -1;
        this.minY = (this.height / 2) * -1;
        this.maxX = sx - this.width / 2;
        this.maxY = sy - this.height / 2;
        // console.log(sx, sy, this)
    }
    move() {
        this.x += this.moveSpeed * Math.cos(this.direction);
        this.y += this.moveSpeed * Math.sign(this.direction);
        this.x = this.x <= this.minX ? this.minX : this.x;
        this.y = this.y <= this.minY ? this.minY : this.y;
        this.x = this.x >= this.maxX ? this.maxX : this.x;
        this.y = this.y >= this.maxY ? this.maxY : this.y;
    }
}
